package cn.jee.service;

import cn.jee.entity.User;
import cn.jee.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;

@Service
public class UserService {
  @Autowired
  UserRepository userRepository;
  public boolean login(User user){
    String password = DigestUtils.md5DigestAsHex(user.getPassword().getBytes());
    var res=userRepository.findByUsernameAndPassword(user.getUsername(),password);
    return res.isPresent();
  }
}
